package cn.bearspark.tag.provider.dao.key;

import cn.bearspark.framework.redis.starter.buffer.hash.un.RedisHashBufferKeyBuilder;
import cn.bearspark.framework.redis.starter.key.RedisKeyBuilder;
import org.springframework.stereotype.Component;

/**
 * 标签缓存键的构造器
 *
 * @author f
 */
@Component
public class TagBufferKeyBuilder extends RedisKeyBuilder implements RedisHashBufferKeyBuilder {

    /**
     * 标签数据的缓存键的前缀
     */
    private static final String TAG_INFO = "tagInfo";

    /**
     * 最近最热的 9 个标签 id 的缓存
     */
    private static final String RECENT_TOP_9_TAG = "recentTop9Tag";

    @Override
    public String buildHashBufferKey(long tagId) {
        return super.getPrefix() + TAG_INFO + super.getSplitItem() + tagId;
    }

    public String buildRT9TagKey() {
        return super.getPrefix() + RECENT_TOP_9_TAG;
    }
}
